* This script contains the code to obtain the Lag length of each model used in Ductor, L., Fafchamps, M., Goyal S. and M. van der Leij. Social Networks and Research Output. The Review of Economics and Statistics. 

log using modelselection_fs.log, replace
use prodndnp_fullsample.dta


/*OLS out-of-sample program*/
cap pro drop ols_os
program define ols_os
syntax varlist(numeric min=1) [if]
marksample touse
quietly reg `varlist' if `touse', vce(cluster auth) /* Estimating the model*/
qui scalar n1=e(N)  /*saving the number of observations*/
estat ic
scalar rmseols=e(rmse)  /*saving the RMSE in-sample*/
scalar r2i1ols= e(r2)   /*computing the R2 of the baseline model*/
predict ybols if group==2 & lprodf3<., xb  /*predicting future output using the out-of-sample*/
qui gen sqerrols= (lprodf3-ybols)^2 if ybols<. /* obtaining the residual squares*/
quietly egen peols=sum(sqerrols)if ybols<.  /* Residual Sum of Squares (RSS) of the predicted model*/
quietly sum peols    /*summarizing the RSS*/
quietly scalar rssols=r(max)  /*obtaining the total RSS*/
quietly scalar nols=r(N)    /*number of observations in group 2*/
scalar rmseo2ols=(rssols/(nols))^0.5   /*RMSE out of sample*/
di n1 " Number of observations in the in-sample group"
di rmseo2ols "  Pooled OLS out-of-sample RMSE"
di r2i1ols "R-squared"
di nols " Number of observations in the out-of-sample group"
drop sqerrols peols ybols
end


sort auth year
foreach i in 17 18 19 20 21 22 23 24 25 26 27{
gen lprodf3l`i'=L`i-1'.lprodf3l
replace lprodf3l`i'=0 if missing(lprodf3l`i')
}

/************************ Lag Length Model 1'***********************/

order auth year t2-t27 lcprod5 lcprodl5 lprodf3 lprodf3l*

ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l24 if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l23 if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l22 if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l21 if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l20 if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l19 if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l18 if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l17 if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l16 if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l15 if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l14 if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l12 if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l11 if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l10 if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l9 if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l8 if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l7 if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l6 if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l5 if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l4 if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l3 if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l2 if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l if group==1

/*The best model in terms of BIC and RMSE out-of-sample contains 13 lags*/

/************************ Lag Length Table 6, MODELS 3: INCLUDE OUTPUT AND A NETWORK VARIABLE***********************/
/*Selecting the lag length of Table 6, Model 3 coauthors' productivity*/

ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y lnetprod2y lnetprod3y lnetprod4y lnetprod5y lnetprod6y lnetprod7y lnetprod8y lnetprod9y lnetprod10y lnetprod11y lnetprod12y lnetprod13y lnetprod14y lnetprod15y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y lnetprod2y lnetprod3y lnetprod4y lnetprod5y lnetprod6y lnetprod7y lnetprod8y lnetprod9y lnetprod10y lnetprod11y lnetprod12y lnetprod13y lnetprod14y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y lnetprod2y lnetprod3y lnetprod4y lnetprod5y lnetprod6y lnetprod7y lnetprod8y lnetprod9y lnetprod10y lnetprod11y lnetprod12y lnetprod13y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y lnetprod2y lnetprod3y lnetprod4y lnetprod5y lnetprod6y lnetprod7y lnetprod8y lnetprod9y lnetprod10y lnetprod11y lnetprod12y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y lnetprod2y lnetprod3y lnetprod4y lnetprod5y lnetprod6y lnetprod7y lnetprod8y lnetprod9y lnetprod10y lnetprod11y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y lnetprod2y lnetprod3y lnetprod4y lnetprod5y lnetprod6y lnetprod7y lnetprod8y lnetprod9y lnetprod10y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y lnetprod2y lnetprod3y lnetprod4y lnetprod5y lnetprod6y lnetprod7y lnetprod8y lnetprod9y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y lnetprod2y lnetprod3y lnetprod4y lnetprod5y lnetprod6y lnetprod7y lnetprod8y if group==1 
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y lnetprod2y lnetprod3y lnetprod4y lnetprod5y lnetprod6y lnetprod7y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y lnetprod2y lnetprod3y lnetprod4y lnetprod5y lnetprod6y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y lnetprod2y lnetprod3y lnetprod4y lnetprod5y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y lnetprod2y lnetprod3y lnetprod4y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y lnetprod2y lnetprod3y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y lnetprod2y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y if group==1

/*Best model: lag 12*/

/*Selecting the lag length of Table 6, Model 3 coauthors' coauthors productivity*/


ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod21y lnetprod22y lnetprod23y lnetprod24y lnetprod25y lnetprod26y lnetprod27y lnetprod28y lnetprod29y lnetprod210y lnetprod211y lnetprod212y lnetprod213y lnetprod214y lnetprod215y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod21y lnetprod22y lnetprod23y lnetprod24y lnetprod25y lnetprod26y lnetprod27y lnetprod28y lnetprod29y lnetprod210y lnetprod211y lnetprod212y lnetprod213y lnetprod214y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod21y lnetprod22y lnetprod23y lnetprod24y lnetprod25y lnetprod26y lnetprod27y lnetprod28y lnetprod29y lnetprod210y lnetprod211y lnetprod212y lnetprod213y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod21y lnetprod22y lnetprod23y lnetprod24y lnetprod25y lnetprod26y lnetprod27y lnetprod28y lnetprod29y lnetprod210y lnetprod211y lnetprod212y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod21y lnetprod22y lnetprod23y lnetprod24y lnetprod25y lnetprod26y lnetprod27y lnetprod28y lnetprod29y lnetprod210y lnetprod211y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod21y lnetprod22y lnetprod23y lnetprod24y lnetprod25y lnetprod26y lnetprod27y lnetprod28y lnetprod29y lnetprod210y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod21y lnetprod22y lnetprod23y lnetprod24y lnetprod25y lnetprod26y lnetprod27y lnetprod28y lnetprod29y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod21y lnetprod22y lnetprod23y lnetprod24y lnetprod25y lnetprod26y lnetprod27y lnetprod28y if group==1 
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod21y lnetprod22y lnetprod23y lnetprod24y lnetprod25y lnetprod26y lnetprod27y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod21y lnetprod22y lnetprod23y lnetprod24y lnetprod25y lnetprod26y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod21y lnetprod22y lnetprod23y lnetprod24y lnetprod25y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod21y lnetprod22y lnetprod23y lnetprod24y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod21y lnetprod22y lnetprod23y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod21y lnetprod22y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod21y if group==1
/* Best model: 11 lags*/

/*Selecting the lag length of Table 6, Model 3 Degree*/


ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree1y degree2y degree3y degree4y degree5y degree6y degree7y degree8y degree9y degree10y degree11y degree12y degree13y degree14y degree15y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree1y degree2y degree3y degree4y degree5y degree6y degree7y degree8y degree9y degree10y degree11y degree12y degree13y degree14y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree1y degree2y degree3y degree4y degree5y degree6y degree7y degree8y degree9y degree10y degree11y degree12y degree13y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree1y degree2y degree3y degree4y degree5y degree6y degree7y degree8y degree9y degree10y degree11y degree12y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree1y degree2y degree3y degree4y degree5y degree6y degree7y degree8y degree9y degree10y degree11y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree1y degree2y degree3y degree4y degree5y degree6y degree7y degree8y degree9y degree10y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree1y degree2y degree3y degree4y degree5y degree6y degree7y degree8y degree9y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree1y degree2y degree3y degree4y degree5y degree6y degree7y degree8y if group==1 
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree1y degree2y degree3y degree4y degree5y degree6y degree7y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree1y degree2y degree3y degree4y degree5y degree6y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree1y degree2y degree3y degree4y degree5y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree1y degree2y degree3y degree4y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree1y degree2y degree3y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree1y degree2y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree1y if group==1

/* Best model: 6 lags*/

/*Selecting the lag length of Table 6, Model 3 Degree 2*/



ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree21y degree22y degree23y degree24y degree25y degree26y degree27y degree28y degree29y degree210y degree211y degree212y degree213y degree214y degree215y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree21y degree22y degree23y degree24y degree25y degree26y degree27y degree28y degree29y degree210y degree211y degree212y degree213y degree214y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree21y degree22y degree23y degree24y degree25y degree26y degree27y degree28y degree29y degree210y degree211y degree212y degree213y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree21y degree22y degree23y degree24y degree25y degree26y degree27y degree28y degree29y degree210y degree211y degree212y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree21y degree22y degree23y degree24y degree25y degree26y degree27y degree28y degree29y degree210y degree211y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree21y degree22y degree23y degree24y degree25y degree26y degree27y degree28y degree29y degree210y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree21y degree22y degree23y degree24y degree25y degree26y degree27y degree28y degree29y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree21y degree22y degree23y degree24y degree25y degree26y degree27y degree28y if group==1 
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree21y degree22y degree23y degree24y degree25y degree26y degree27y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree21y degree22y degree23y degree24y degree25y degree26y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree21y degree22y degree23y degree24y degree25y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree21y degree22y degree23y degree24y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree21y degree22y degree23y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree21y degree22y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 degree21y if group==1

/*Best model: lags 5*/

/*Selecting the lag length of Table 6, Model 3 Giant Component*/

ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc15y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc14y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc13y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc12y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc11y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc10y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc9y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc8y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc7y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc6y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc5y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc4y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc3y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y  if group==1
/*lags 8*/

/*Selecting the lag length of Table 6, Model 3 Betweenness*/

ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc15y lbet1y-lbet15y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc14y lbet1y-lbet14y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc13y  lbet1y-lbet13y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc12y  lbet1y-lbet12y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc11y lbet1y-lbet11y   if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc10y lbet1y-lbet10y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc9y lbet1y-lbet9y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc8y lbet1y-lbet8y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc7y lbet1y-lbet7y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc6y lbet1y-lbet6y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc5y lbet1y-lbet5y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc4y lbet1y-lbet4y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc3y lbet1y-lbet3y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y lbet1y lbet2y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y lbet1y if group==1
/* lags 9*/

/*Selecting the lag length of Table 6, Model 3 Closeness*/

ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc15y lclos1y-lclos15y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc14y lclos1y-lclos14y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc13y  lclos1y-lclos13y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc12y  lclos1y-lclos12y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc11y lclos1y-lclos11y   if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc10y lclos1y-lclos10y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc9y lclos1y-lclos9y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc8y lclos1y-lclos8y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc7y lclos1y-lclos7y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc6y lclos1y-lclos6y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc5y lclos1y-lclos5y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc4y lclos1y-lclos4y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y-gc3y lclos1y-lclos3y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y gc2y lclos1y lclos2y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 gc1y lclos1y if group==1
/*lags 10*/

/*Selecting the lag length of Table 6, Model 3 Working with a top 1%*/


ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 neiq1fs1y neiq1fs2y neiq1fs3y neiq1fs4y neiq1fs5y neiq1fs6y neiq1fs7y neiq1fs8y neiq1fs9y neiq1fs10y neiq1fs11y neiq1fs12y neiq1fs13y neiq1fs14y neiq1fs15y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 neiq1fs1y neiq1fs2y neiq1fs3y neiq1fs4y neiq1fs5y neiq1fs6y neiq1fs7y neiq1fs8y neiq1fs9y neiq1fs10y neiq1fs11y neiq1fs12y neiq1fs13y neiq1fs14y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 neiq1fs1y neiq1fs2y neiq1fs3y neiq1fs4y neiq1fs5y neiq1fs6y neiq1fs7y neiq1fs8y neiq1fs9y neiq1fs10y neiq1fs11y neiq1fs12y neiq1fs13y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 neiq1fs1y neiq1fs2y neiq1fs3y neiq1fs4y neiq1fs5y neiq1fs6y neiq1fs7y neiq1fs8y neiq1fs9y neiq1fs10y neiq1fs11y neiq1fs12y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 neiq1fs1y neiq1fs2y neiq1fs3y neiq1fs4y neiq1fs5y neiq1fs6y neiq1fs7y neiq1fs8y neiq1fs9y neiq1fs10y neiq1fs11y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 neiq1fs1y neiq1fs2y neiq1fs3y neiq1fs4y neiq1fs5y neiq1fs6y neiq1fs7y neiq1fs8y neiq1fs9y neiq1fs10y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 neiq1fs1y neiq1fs2y neiq1fs3y neiq1fs4y neiq1fs5y neiq1fs6y neiq1fs7y neiq1fs8y neiq1fs9y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 neiq1fs1y neiq1fs2y neiq1fs3y neiq1fs4y neiq1fs5y neiq1fs6y neiq1fs7y neiq1fs8y if group==1 
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 neiq1fs1y neiq1fs2y neiq1fs3y neiq1fs4y neiq1fs5y neiq1fs6y neiq1fs7y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 neiq1fs1y neiq1fs2y neiq1fs3y neiq1fs4y neiq1fs5y neiq1fs6y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 neiq1fs1y neiq1fs2y neiq1fs3y neiq1fs4y neiq1fs5y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 neiq1fs1y neiq1fs2y neiq1fs3y neiq1fs4y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 neiq1fs1y neiq1fs2y neiq1fs3y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 neiq1fs1y neiq1fs2y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 neiq1fs1y if group==1

/************************ Lag Length Table 5, MODELS 2: INCLUDE A NETWORK VARIABLE***********************/
/*Selecting the lag length of Table 5, Model 2 Coauthors' productivity*/


ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod1y lnetprod2y lnetprod3y lnetprod4y lnetprod5y lnetprod6y lnetprod7y lnetprod8y lnetprod9y lnetprod10y lnetprod11y lnetprod12y lnetprod13y lnetprod14y lnetprod15y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod1y lnetprod2y lnetprod3y lnetprod4y lnetprod5y lnetprod6y lnetprod7y lnetprod8y lnetprod9y lnetprod10y lnetprod11y lnetprod12y lnetprod13y lnetprod14y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod1y lnetprod2y lnetprod3y lnetprod4y lnetprod5y lnetprod6y lnetprod7y lnetprod8y lnetprod9y lnetprod10y lnetprod11y lnetprod12y lnetprod13y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod1y lnetprod2y lnetprod3y lnetprod4y lnetprod5y lnetprod6y lnetprod7y lnetprod8y lnetprod9y lnetprod10y lnetprod11y lnetprod12y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod1y lnetprod2y lnetprod3y lnetprod4y lnetprod5y lnetprod6y lnetprod7y lnetprod8y lnetprod9y lnetprod10y lnetprod11y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod1y lnetprod2y lnetprod3y lnetprod4y lnetprod5y lnetprod6y lnetprod7y lnetprod8y lnetprod9y lnetprod10y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod1y lnetprod2y lnetprod3y lnetprod4y lnetprod5y lnetprod6y lnetprod7y lnetprod8y lnetprod9y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod1y lnetprod2y lnetprod3y lnetprod4y lnetprod5y lnetprod6y lnetprod7y lnetprod8y if group==1 
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod1y lnetprod2y lnetprod3y lnetprod4y lnetprod5y lnetprod6y lnetprod7y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod1y lnetprod2y lnetprod3y lnetprod4y lnetprod5y lnetprod6y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod1y lnetprod2y lnetprod3y lnetprod4y lnetprod5y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod1y lnetprod2y lnetprod3y lnetprod4y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod1y lnetprod2y lnetprod3y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod1y lnetprod2y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod1y if group==1
/*12y lowest BIC*/

/*Selecting the lag length of Table 5, Model 2 Coauthors' coauthors productivity*/


ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod21y lnetprod22y lnetprod23y lnetprod24y lnetprod25y lnetprod26y lnetprod27y lnetprod28y lnetprod29y lnetprod210y lnetprod211y lnetprod212y lnetprod213y lnetprod214y lnetprod215y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod21y lnetprod22y lnetprod23y lnetprod24y lnetprod25y lnetprod26y lnetprod27y lnetprod28y lnetprod29y lnetprod210y lnetprod211y lnetprod212y lnetprod213y lnetprod214y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod21y lnetprod22y lnetprod23y lnetprod24y lnetprod25y lnetprod26y lnetprod27y lnetprod28y lnetprod29y lnetprod210y lnetprod211y lnetprod212y lnetprod213y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod21y lnetprod22y lnetprod23y lnetprod24y lnetprod25y lnetprod26y lnetprod27y lnetprod28y lnetprod29y lnetprod210y lnetprod211y lnetprod212y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod21y lnetprod22y lnetprod23y lnetprod24y lnetprod25y lnetprod26y lnetprod27y lnetprod28y lnetprod29y lnetprod210y lnetprod211y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod21y lnetprod22y lnetprod23y lnetprod24y lnetprod25y lnetprod26y lnetprod27y lnetprod28y lnetprod29y lnetprod210y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod21y lnetprod22y lnetprod23y lnetprod24y lnetprod25y lnetprod26y lnetprod27y lnetprod28y lnetprod29y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod21y lnetprod22y lnetprod23y lnetprod24y lnetprod25y lnetprod26y lnetprod27y lnetprod28y if group==1 
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod21y lnetprod22y lnetprod23y lnetprod24y lnetprod25y lnetprod26y lnetprod27y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod21y lnetprod22y lnetprod23y lnetprod24y lnetprod25y lnetprod26y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod21y lnetprod22y lnetprod23y lnetprod24y lnetprod25y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod21y lnetprod22y lnetprod23y lnetprod24y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod21y lnetprod22y lnetprod23y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod21y lnetprod22y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  lnetprod21y if group==1
/* 15y lowest BIC*/

/*Selecting the lag length of Table 5, Model 2 Degree*/


ols_os lprodf3 y2-y27 nopapers t2-t27  degree1y degree2y degree3y degree4y degree5y degree6y degree7y degree8y degree9y degree10y degree11y degree12y degree13y degree14y degree15y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  degree1y degree2y degree3y degree4y degree5y degree6y degree7y degree8y degree9y degree10y degree11y degree12y degree13y degree14y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  degree1y degree2y degree3y degree4y degree5y degree6y degree7y degree8y degree9y degree10y degree11y degree12y degree13y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  degree1y degree2y degree3y degree4y degree5y degree6y degree7y degree8y degree9y degree10y degree11y degree12y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  degree1y degree2y degree3y degree4y degree5y degree6y degree7y degree8y degree9y degree10y degree11y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  degree1y degree2y degree3y degree4y degree5y degree6y degree7y degree8y degree9y degree10y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  degree1y degree2y degree3y degree4y degree5y degree6y degree7y degree8y degree9y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  degree1y degree2y degree3y degree4y degree5y degree6y degree7y degree8y if group==1 
ols_os lprodf3 y2-y27 nopapers t2-t27  degree1y degree2y degree3y degree4y degree5y degree6y degree7y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  degree1y degree2y degree3y degree4y degree5y degree6y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  degree1y degree2y degree3y degree4y degree5y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  degree1y degree2y degree3y degree4y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  degree1y degree2y degree3y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  degree1y degree2y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  degree1y if group==1
/* 15y lowest BIC*/


/*Selecting the lag length of Table 5, Model 2 Degree 2*/



ols_os lprodf3 y2-y27 nopapers t2-t27  degree21y degree22y degree23y degree24y degree25y degree26y degree27y degree28y degree29y degree210y degree211y degree212y degree213y degree214y degree215y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  degree21y degree22y degree23y degree24y degree25y degree26y degree27y degree28y degree29y degree210y degree211y degree212y degree213y degree214y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  degree21y degree22y degree23y degree24y degree25y degree26y degree27y degree28y degree29y degree210y degree211y degree212y degree213y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  degree21y degree22y degree23y degree24y degree25y degree26y degree27y degree28y degree29y degree210y degree211y degree212y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  degree21y degree22y degree23y degree24y degree25y degree26y degree27y degree28y degree29y degree210y degree211y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  degree21y degree22y degree23y degree24y degree25y degree26y degree27y degree28y degree29y degree210y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  degree21y degree22y degree23y degree24y degree25y degree26y degree27y degree28y degree29y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  degree21y degree22y degree23y degree24y degree25y degree26y degree27y degree28y if group==1 
ols_os lprodf3 y2-y27 nopapers t2-t27  degree21y degree22y degree23y degree24y degree25y degree26y degree27y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  degree21y degree22y degree23y degree24y degree25y degree26y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  degree21y degree22y degree23y degree24y degree25y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  degree21y degree22y degree23y degree24y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  degree21y degree22y degree23y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  degree21y degree22y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  degree21y if group==1
/* 14y lowest BIC*/


/*Selecting the lag length of Table 5, Model 2 Giant Component*/

ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc15y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc14y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc13y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc12y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc11y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc10y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc9y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc8y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc7y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc6y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc5y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc4y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc3y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y  if group==1
/* 15y lowest BIC*/

/*Selecting the lag length of Table 5, Model 2 Betweenness*/

ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc15y lbet1y-lbet15y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc14y lbet1y-lbet14y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc13y  lbet1y-lbet13y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc12y  lbet1y-lbet12y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc11y lbet1y-lbet11y   if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc10y lbet1y-lbet10y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc9y lbet1y-lbet9y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc8y lbet1y-lbet8y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc7y lbet1y-lbet7y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc6y lbet1y-lbet6y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc5y lbet1y-lbet5y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc4y lbet1y-lbet4y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc3y lbet1y-lbet3y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y lbet1y lbet2y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y lbet1y if group==1
/* 15y lowest BIC*/

/*Selecting the lag length of Table 5, Model 2 Closeness*/

ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc15y lclos1y-lclos15y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc14y lclos1y-lclos14y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc13y  lclos1y-lclos13y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc12y  lclos1y-lclos12y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc11y lclos1y-lclos11y   if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc10y lclos1y-lclos10y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc9y lclos1y-lclos9y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc8y lclos1y-lclos8y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc7y lclos1y-lclos7y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc6y lclos1y-lclos6y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc5y lclos1y-lclos5y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc4y lclos1y-lclos4y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y-gc3y lclos1y-lclos3y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y gc2y lclos1y lclos2y  if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  gc1y lclos1y if group==1
/* 15y lowest BIC*/

/*Selecting the lag length of Table 5, Model 2 Coauthors' productivity*/

ols_os lprodf3 y2-y27 nopapers t2-t27  neiq1fs1y neiq1fs2y neiq1fs3y neiq1fs4y neiq1fs5y neiq1fs6y neiq1fs7y neiq1fs8y neiq1fs9y neiq1fs10y neiq1fs11y neiq1fs12y neiq1fs13y neiq1fs14y neiq1fs15y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  neiq1fs1y neiq1fs2y neiq1fs3y neiq1fs4y neiq1fs5y neiq1fs6y neiq1fs7y neiq1fs8y neiq1fs9y neiq1fs10y neiq1fs11y neiq1fs12y neiq1fs13y neiq1fs14y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  neiq1fs1y neiq1fs2y neiq1fs3y neiq1fs4y neiq1fs5y neiq1fs6y neiq1fs7y neiq1fs8y neiq1fs9y neiq1fs10y neiq1fs11y neiq1fs12y neiq1fs13y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  neiq1fs1y neiq1fs2y neiq1fs3y neiq1fs4y neiq1fs5y neiq1fs6y neiq1fs7y neiq1fs8y neiq1fs9y neiq1fs10y neiq1fs11y neiq1fs12y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  neiq1fs1y neiq1fs2y neiq1fs3y neiq1fs4y neiq1fs5y neiq1fs6y neiq1fs7y neiq1fs8y neiq1fs9y neiq1fs10y neiq1fs11y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  neiq1fs1y neiq1fs2y neiq1fs3y neiq1fs4y neiq1fs5y neiq1fs6y neiq1fs7y neiq1fs8y neiq1fs9y neiq1fs10y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  neiq1fs1y neiq1fs2y neiq1fs3y neiq1fs4y neiq1fs5y neiq1fs6y neiq1fs7y neiq1fs8y neiq1fs9y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  neiq1fs1y neiq1fs2y neiq1fs3y neiq1fs4y neiq1fs5y neiq1fs6y neiq1fs7y neiq1fs8y if group==1 
ols_os lprodf3 y2-y27 nopapers t2-t27  neiq1fs1y neiq1fs2y neiq1fs3y neiq1fs4y neiq1fs5y neiq1fs6y neiq1fs7y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  neiq1fs1y neiq1fs2y neiq1fs3y neiq1fs4y neiq1fs5y neiq1fs6y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  neiq1fs1y neiq1fs2y neiq1fs3y neiq1fs4y neiq1fs5y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  neiq1fs1y neiq1fs2y neiq1fs3y neiq1fs4y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  neiq1fs1y neiq1fs2y neiq1fs3y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  neiq1fs1y neiq1fs2y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27  neiq1fs1y if group==1
/* 14y lowest BIC*/

/************************ Table 7 Lag length. Multivariate Model 2: INCLUDE All THE RELEVANT NETWORK VARIABLES***********************/

/*Stepwise*/

ols_os lprodf3 y2-y27 nopapers t2-t27 lnetprod1y-lnetprod15y lnetprod21y-lnetprod215y degree1y-degree15y degree21y-degree215y gc1y-gc15y lbet1y-lbet15y lclos1y-lclos15y neiq1fs1y-neiq1fs15y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lnetprod1y-lnetprod14y lnetprod21y-lnetprod214y degree1y-degree14y degree21y-degree214y gc1y-gc14y lbet1y-lbet14y lclos1y-lclos14y neiq1fs1y-neiq1fs14y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lnetprod1y-lnetprod13y lnetprod21y-lnetprod213y degree1y-degree13y degree21y-degree213y gc1y-gc13y lbet1y-lbet13y lclos1y-lclos13y neiq1fs1y-neiq1fs13y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lnetprod1y-lnetprod12y lnetprod21y-lnetprod212y degree1y-degree12y degree21y-degree212y gc1y-gc12y lbet1y-lbet12y lclos1y-lclos12y neiq1fs1y-neiq1fs12y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lnetprod1y-lnetprod11y lnetprod21y-lnetprod211y degree1y-degree11y degree21y-degree211y gc1y-gc11y lbet1y-lbet11y lclos1y-lclos11y neiq1fs1y-neiq1fs11y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lnetprod1y-lnetprod10y lnetprod21y-lnetprod210y degree1y-degree10y degree21y-degree210y gc1y-gc10y lbet1y-lbet10y lclos1y-lclos10y neiq1fs1y-neiq1fs10y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lnetprod1y-lnetprod9y lnetprod21y-lnetprod29y degree1y-degree9y degree21y-degree29y gc1y-gc9y lbet1y-lbet9y lclos1y-lclos9y neiq1fs1y-neiq1fs9y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lnetprod1y-lnetprod8y lnetprod21y-lnetprod28y degree1y-degree8y degree21y-degree28y gc1y-gc8y lbet1y-lbet8y lclos1y-lclos8y neiq1fs1y-neiq1fs8y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lnetprod1y-lnetprod7y lnetprod21y-lnetprod27y degree1y-degree7y degree21y-degree27y gc1y-gc7y lbet1y-lbet7y lclos1y-lclos7y neiq1fs1y-neiq1fs7y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lnetprod1y-lnetprod6y lnetprod21y-lnetprod26y degree1y-degree6y degree21y-degree26y gc1y-gc6y lbet1y-lbet6y lclos1y-lclos6y neiq1fs1y-neiq1fs6y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lnetprod1y-lnetprod5y lnetprod21y-lnetprod25y degree1y-degree5y degree21y-degree25y gc1y-gc5y lbet1y-lbet5y lclos1y-lclos5y neiq1fs1y-neiq1fs5y if group==1




/************************Multivariate Model 3: Past output+All THE RELEVANT NETWORK VARIABLES***********************/

/*Stepwise*/

ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y-lnetprod15y lnetprod21y-lnetprod215y degree1y-degree15y degree21y-degree215y gc1y-gc15y lbet1y-lbet15y lclos1y-lclos15y neiq1fs1y-neiq1fs15y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y-lnetprod14y lnetprod21y-lnetprod214y degree1y-degree14y degree21y-degree214y gc1y-gc14y lbet1y-lbet14y lclos1y-lclos14y neiq1fs1y-neiq1fs14y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y-lnetprod13y lnetprod21y-lnetprod213y degree1y-degree13y degree21y-degree213y gc1y-gc13y lbet1y-lbet13y lclos1y-lclos13y neiq1fs1y-neiq1fs13y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y-lnetprod12y lnetprod21y-lnetprod212y degree1y-degree12y degree21y-degree212y gc1y-gc12y lbet1y-lbet12y lclos1y-lclos12y neiq1fs1y-neiq1fs12y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y-lnetprod11y lnetprod21y-lnetprod211y degree1y-degree11y degree21y-degree211y gc1y-gc11y lbet1y-lbet11y lclos1y-lclos11y neiq1fs1y-neiq1fs11y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y-lnetprod10y lnetprod21y-lnetprod210y degree1y-degree10y degree21y-degree210y gc1y-gc10y lbet1y-lbet10y lclos1y-lclos10y neiq1fs1y-neiq1fs10y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y-lnetprod9y lnetprod21y-lnetprod29y degree1y-degree9y degree21y-degree29y gc1y-gc9y lbet1y-lbet9y lclos1y-lclos9y neiq1fs1y-neiq1fs9y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y-lnetprod8y lnetprod21y-lnetprod28y degree1y-degree8y degree21y-degree28y gc1y-gc8y lbet1y-lbet8y lclos1y-lclos8y neiq1fs1y-neiq1fs8y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y-lnetprod7y lnetprod21y-lnetprod27y degree1y-degree7y degree21y-degree27y gc1y-gc7y lbet1y-lbet7y lclos1y-lclos7y neiq1fs1y-neiq1fs7y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y-lnetprod6y lnetprod21y-lnetprod26y degree1y-degree6y degree21y-degree26y gc1y-gc6y lbet1y-lbet6y lclos1y-lclos6y neiq1fs1y-neiq1fs6y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y-lnetprod5y lnetprod21y-lnetprod25y degree1y-degree5y degree21y-degree25y gc1y-gc5y lbet1y-lbet5y lclos1y-lclos5y neiq1fs1y-neiq1fs5y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y-lnetprod4y lnetprod21y-lnetprod24y degree1y-degree4y degree21y-degree24y gc1y-gc4y lbet1y-lbet4y lclos1y-lclos4y neiq1fs1y-neiq1fs4y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y-lnetprod3y lnetprod21y-lnetprod23y degree1y-degree3y degree21y-degree23y gc1y-gc3y lbet1y-lbet3y lclos1y-lclos3y neiq1fs1y-neiq1fs3y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y-lnetprod2y lnetprod21y-lnetprod22y degree1y-degree2y degree21y-degree22y gc1y-gc2y lbet1y-lbet2y lclos1y-lclos2y neiq1fs1y-neiq1fs2y if group==1
ols_os lprodf3 y2-y27 nopapers t2-t27 lprodf3l-lprodf3l13 lnetprod1y-lnetprod1y lnetprod21y-lnetprod21y degree1y-degree1y degree21y-degree21y gc1y-gc1y lbet1y-lbet1y lclos1y-lclos1y neiq1fs1y-neiq1fs1y if group==1

/*8 lag, lowest BIC*/

log close
